import { request } from '../utils/request'
// 注释掉原来的BASE_URL_USER定义，使用request.ts中定义的BASE_URL
// const BASE_URL_USER = 'http://dev.basic.lbs.p.yufeiworld.com' //普通正常数据 用户、商家等
// const BASE_URL_USER = 'http://dev.gateway.lbs.p.yufeiworld.com' //普通正常数据 用户、商家等
// const BASE_URL_USER = 'http://' //普通正常数据 用户、商家等

// 用户详情
export const request_get_user_detail = () => {
	return request({
		url: `/basic/user/detail`,
		method: "GET",
		header: {
			'content-Type': 'x-www-form-urlencoded;charset=UTF-8'
		}
	})
}

export const requestAdminBasicUserDetail = (id: number) => {
	return request({
		url: `/admin/basic/user/detail/${id}`,
		method: "GET",
		header: {
			'content-Type': 'x-www-form-urlencoded;charset=UTF-8'
		}
	})
}

export type UserList = {
	endDate: string,
	pageNo: number,
	pageSize: number,
	phone: string,
	startDate: string,
	userName: string
}
// 获取用户列表-分页
export const requestAdminUserList = (userList: Partial<UserList>) => {
	return request({
		url: "/admin/basic/user/list",
		method: "POST",
		data: userList
	})
}

export type USER_REGISTER = {
	password : string
	phone : string
}
// 用户注册
export const request_post_user_regiter = (userRegister : USER_REGISTER) => {

	uni.clearStorageSync();
	return request({
		url: "/basic/user/info/register",
		method: "POST",
		data: userRegister
	})
}


//用户修改资料
export type USER_INFO = {
	endDate : string //截止时间
	id : number //用户ID
	nickName : string //用户昵称
	password : string //密码
	phone : number //手机号
	providerType : string //渠道来源
	startDate : string //注册开始时间
	userImage : string //用户头像ID
	userName : string //用户姓名
}
// 用户修改资料
export const request_post_user_info = (userInfo : USER_INFO) => {
	return request({
		url: "/basic/user/info/save",
		method: "POST",
		data: userInfo
	})
}

export type USER_INTEREST = {
	storeId : number
	userId : number
}
// 关注用户
export const request_post_user_interest = (userInterest : USER_INTEREST) => {
	return request({
		url: "/basic/user/interest",
		method: "POST",
		data: userInterest
	})
}


export type USER_INTEREST_LIST = {
	page : number
	pageSize : number
	userId : number
}
// 用户关注列表
export const request_post_user_interest_list = (userInterestList : USER_INTEREST_LIST) => {
	return request({
		url: "/basic/user/interest/list",
		method: "POST",
		data: userInterestList
	})
}